import request from "@/utils/request";

/**
* 收货地址表数据
*
* @param queryParams
*/
export function getSysAddressPage(queryParams) {
    return request({
        url: '/api/v1/address/page',
        method: 'get',
        params: queryParams
    });
}


/**
* 获取收货地址表表单数据
*
* @param queryParams
*/
export function getSysAddressForm(id) {
    return request({
        url: '/api/v1/address/' + id + '/form',
        method: 'get'
    });
}

/**
* 保存收货地址表
*
* @param data
*/
export function saveSysAddress(data) {
    return request({
        url: "/api/v1/address",
        method: "post",
        data: data,
    });
}

/**
* 删除收货地址表
*
* @param ids
*/
export function deleteSysAddress(ids) {
    return request({
        url: '/api/v1/address/' + ids,
        method: 'delete'
    });
}

/**
* 导入收货地址表
*
* @param file
*/
export function importSysAddress(file: any) {
    const formData = new FormData();
    formData.append('file', file);
    return request({
        url: '/api/v1/address/sysAddressImport',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    });
}

/**
* 导出收货地址表
*
* @param ids
* @returns
*/
export function exportSysAddress(ids: any) {
    return request({
        url: '/api/v1/address/_export?ids='+ids,
        method: 'get',
        responseType: 'arraybuffer'
    });
}